package com.bot.adms.service.impl;

import com.bot.adms.dao.ICheckRecordInfoDao;
import com.bot.adms.dao.impl.CheckRecordInfoDaoImpl;
import com.bot.adms.model.entity.CheckRecordInfo;
import com.bot.adms.model.vo.CheckRecordInfoVo;
import com.bot.adms.service.ICheckRecordService;

import java.util.ArrayList;
import java.util.List;

/**
 * 审核记录模块业务接口实现
 * 包含：
 * 查看审核记录
 * 功能
 *
 * @author ZHOUTAO、LiuZiHan、XiHao
 */
public class CheckRecordServiceImpl implements ICheckRecordService {
    private ICheckRecordInfoDao checkRecordInfoDao;

    public CheckRecordServiceImpl() {
        this.checkRecordInfoDao = new CheckRecordInfoDaoImpl();
    }

    /**
     * c审核记录
     *
     * @param applyId 投放申请id
     * @return List<CheckRecordInfoVo> 审核记录信息视图模型集合，包含：投放申请id,审核人等等
     */
    @Override
    public List<CheckRecordInfoVo> lookCheckRecord(Long applyId) {
        List<CheckRecordInfoVo> checkRecordInfoVoList = new ArrayList<>();
        //1.限制条件验证
        CheckRecordInfo checkRecordInfo = new CheckRecordInfo();
        checkRecordInfo.setApplyId(applyId);
        //2.调用dao层查询
        List<CheckRecordInfo> checkRecordInfoList = checkRecordInfoDao.searchCheckRecordInfo(checkRecordInfo);
        for (CheckRecordInfo checkRecordInfo1 : checkRecordInfoList) {
            //3.entity转vo
            CheckRecordInfoVo checkRecordInfoVo = new CheckRecordInfoVo(checkRecordInfo1);
            checkRecordInfoVoList.add(checkRecordInfoVo);
        }
        return checkRecordInfoVoList;
    }
}
